/**
 * 
 */
package com.py.credit.controller;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.py.credit.common.rest.RestServiceResult;
import com.py.credit.entity.Dept;
import com.py.credit.service.DeptService;
import com.py.framework.core.entity.SysOfficeEntity;

/**
 * @author dd
 *
 */
@RestController
@RequestMapping(value = "/dept")
public class DeptController {

	@Autowired
	private DeptService deptService;

	@RequestMapping(value = "/getTopLevelDept.json")
	public RestServiceResult<List<Dept>> getTopLevelDept() {

		return new RestServiceResult<List<Dept>> (deptService.getTopLevelDept());

	}

	@RequestMapping(value = "/getDeptById.json")
	public RestServiceResult<SysOfficeEntity> getDeptById(@RequestParam(value = "id") String id) {
		
		return new RestServiceResult<SysOfficeEntity> (deptService.getDeptById(id));



	}

}
